home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / C64 / T-TPUG Old Monthly Disks / (c)ts.d64 / 1541 backup.c (.txt) next >
Commodore BASIC  |  2007-02-04  |  7KB  |  179 lines

  1. 100 PRINT"[147]":POKE56,41:CLR:GOTO185
  2. 105 :
  3. 110 *********************************
  4. 115 *    SINGLE DISK BACKUP V1.0    *
  5. 120 *                               *
  6. 125 * WRITTEN: 27, JULY 1982        *
  7. 130 * AUTHOR : MICHAEL SCHAFF       *
  8. 135 *                               *
  9. 140 * CONFIGURATION:                *
  10. 145 *    COMPUTER:        C64       *
  11. 150 *    DISK    :        1541      *
  12. 155 *                               *
  13. 160 *           (C) 1982            *
  14. 165 *  COMMODORE BUSINESS MACHINES  *
  15. 170 *********************************
  16. 175 :
  17. 180 :
  18. 185 POKE53280,1:REM BORDER COLOR
  19. 190 POKE53281,1:REM BACKGROUND COLOR
  20. 195 PRINT""   :REM CHARACTER COLOR
  21. 200 DI=8       :REM DISK DEVICE NUMBER
  22. 205 SP=1389    :REM SCREEN BAR POSITION
  23. 210 SB=10496   :REM START BUFFER
  24. 215 BP=10496   :REM BUFFER POINTER
  25. 220 EB=40960   :REM END BUFFER
  26. 225 :
  27. 230 :
  28. 235 FORA=828TO867:READB:POKEA,B:NEXT
  29. 240 DATA 162,2,32,198,255,160,0,32,165,255,153,0,48,200,208,247,32,204,255,96
  30. 245 DATA 162,2,32,201,255,160,0,185,0,48,32,168,255,200,208,247,32,204,255,96
  31. 250 BL$="                                     [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]"
  32. 255 BL$=BL$+"[157][157][157][157][157][157][157]":DIMBM$(140),C(43):FORA=0TO43:READC(A):NEXT:GOSUB815
  33. 260 DATA 32,101,116,117,97,246,234,231,160,21,21,21,21,21,21,21,21,21,21,21,21
  34. 265 DATA 21,21,21,21,21,19,19,19,19,19,19,19,18,18,18,18,18,18,17,17,17,17,17
  35. 270 PRINT"[147]"SPC(8)"SINGLE DISK BACKUP V1.0"
  36. 275 PRINT""SPC(11)"BY MICHAEL SCHAFF"
  37. 280 PRINT"[213][192]BACKUP COMMAND[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  38. 285 PRINT"[221]                                     [221]"
  39. 290 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
  40. 295 PRINT"[213][192]BUFFER[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  41. 300 PRINT"[194]                         [158]            [221]"
  42. 305 PRINT"[221]    E             [167]              F   [221]"
  43. 310 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
  44. 315 PRINT"[213][192]DISK[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  45. 320 PRINT"[221]                                     [221]"
  46. 325 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
  47. 330 PRINT"[213][192]DISK STATUS[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  48. 335 PRINT"[221]                                     [221]"
  49. 340 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
  50. 345 PRINT"[213][192]EXECUTING[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  51. 350 PRINT"[221]                                     [221]"
  52. 355 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
  53. 360 PRINT"[213][192]OPERATOR INTERVENTION[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  54. 365 PRINT"[221]                                     [221]"
  55. 370 PRINT"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
  56. 375 OP$="ENTER THE PROGRAM OPERATION CODE":GOSUB795:LN=1:DN=7:RT=1
  57. 380 GOSUB730:IFB$=""THENB$="B"
  58. 385 PO=ASC(B$):IFB$="D"THENOP$="DIRECT BACKUP":GOTO400
  59. 390 IFB$<>"B"THEN375
  60. 395 OP$="BAM SELECT BACKUP"
  61. 400 GOSUB785:OP$="":GOSUB780:OP$="ENTER DISK NAME"
  62. 405 GOSUB795:OP$="DESTINATION:":GOSUB790:LN=16:DN=14:RT=17:GOSUB730
  63. 410 LN=2:RT=35:IFB$=""THENB$="CBM 1541 BACKUP":OP$=OP$+"    "+B$:GOSUB790
  64. 415 DN$=B$:PRINT"[145]"SPC(34)",":OP$="ENTER DISK ID NUMBER":GOSUB795
  65. 420 GOSUB730:IFB$=""THENB$="64"
  66. 425 PRINT"[145]"SPC(35)B$:DI$=B$:POKE198,0
  67. 430 BC$="INSERT DESTINATION DISK INTO DRIVE":GOSUB965
  68. 435 GOSUB810:OP$="FORMATING DESTINATION DISK":GOSUB780
  69. 440 OPEN15,DI,15:INPUT#15,EN$,ED$,ET,ES$:IFEN$="00"THEN450
  70. 445 CLOSE15:OP$="":GOSUB780:GOSUB800:OP$="":GOTO405
  71. 450 DN$="N0:"+DN$+","+DI$:PRINT#15,DN$:INPUT#15,EN$,ED$,ET$,ES$
  72. 455 CLOSE15:GOSUB800:IFEN$<>"00"THEN:OP$="":GOSUB780:GOTO405
  73. 460 OP$="":GOSUB780
  74. 465 BC$="INSERT SOURCE DISK INTO DRIVE":GOSUB965
  75. 480 OP$="READING BAM FROM SOURCE DISK":GOSUB780
  76. 485 OPEN15,DI,15:OPEN2,DI,2,"#":PRINT#15,"U1";2;0;18;0:PRINT#15,"B-P:"2;1
  77. 490 GET#2,A$:GET#2,A$:GET#2,A$:FORA=1TO140:GET#2,A$:IFA$=""THENA$=CHR$(0)
  78. 495 BM$(A)=A$:NEXT:INPUT#15,EN$,ED$,ET$,ES$:IFEN$<>"00"THENSTOP
  79. 500 PRINT#15,"B-P";2;144:SN$="":FORA=1TO20:GET#2,A$:SN$=SN$+A$:NEXT
  80. 505 CLOSE2:CLOSE15:SN$=LEFT$(SN$,16)+","+RIGHT$(SN$,2)
  81. 510 DN$=RIGHT$(DN$,LEN(DN$)-3):A$=LEFT$(DN$,LEN(DN$)-3)+"                "
  82. 515 DN$=LEFT$(A$,16)+","+RIGHT$(DN$,2):GOSUB800:OP$="SOURCE:         "+SN$
  83. 520 IFRIGHT$(DN$,2)<>RIGHT$(SN$,2)THEN535
  84. 525 OP$="":GOSUB780:GOSUB790:EN$="*3":ED$="BAD ID NUMBER":ET$="00":ES$="00"
  85. 530 GOSUB800:BC$="ID NUMBERS ARE NOT UNIQUE":GOSUB965:GOTO100
  86. 535 GOSUB790:OP$="":GOSUB780
  87. 540 BC$="VERIFY SOURCE DISK FOR BACKUP":GOSUB965
  88. 545 IFA$<>"N"THEN555
  89. 550 OP$="":GOSUB780:GOSUB790:GOSUB810:GOTO465
  90. 555 OP$="READING DATA INTO BUFFER":GOSUB780
  91. 560 IFPO=68THENFORA=1TO140:BM$(A)=CHR$(0):NEXT
  92. 565 OPEN15,DI,15:OPEN2,DI,2,"#"
  93. 570 FORTC=1TO140STEP4:IFC(((TC-1)/4+1)+8)=ASC(BM$(TC))THEN695
  94. 575 TR=(TC-1)/4+1:BY=255-ASC(BM$(TC+1))
  95. 580 IFBYAND128THENSC=7:GOSUB835
  96. 585 IFBYAND64THENSC=6:GOSUB835
  97. 590 IFBYAND32THENSC=5:GOSUB835
  98. 595 IFBYAND16THENSC=4:GOSUB835
  99. 600 IFBYAND8THENSC=3:GOSUB835
  100. 605 IFBYAND4THENSC=2:GOSUB835
  101. 610 IFBYAND2THENSC=1:GOSUB835
  102. 615 IFBYAND1THENSC=0:GOSUB835
  103. 620 BY=255-ASC(BM$(TC+2))
  104. 625 IFBYAND128THENSC=15:GOSUB835
  105. 630 IFBYAND64THENSC=14:GOSUB835
  106. 635 IFBYAND32THENSC=13:GOSUB835
  107. 640 IFBYAND16THENSC=12:GOSUB835
  108. 645 IFBYAND8THENSC=11:GOSUB835
  109. 650 IFBYAND4THENSC=10:GOSUB835
  110. 655 IFBYAND2THENSC=9:GOSUB835
  111. 660 IFBYAND1THENSC=8:GOSUB835
  112. 665 BY=255-ASC(BM$(TC+3))
  113. 670 IF(BYAND16)ANDC(TR+8)>20THENSC=20:GOSUB835
  114. 675 IF(BYAND8)ANDC(TR+8)>19THENSC=19:GOSUB835
  115. 680 IF(BYAND4)ANDC(TR+8)>18THENSC=18:GOSUB835
  116. 685 IF(BYAND2)ANDC(TR+8)>17THENSC=17:GOSUB835
  117. 690 IF(BYAND1)ANDC(TR+8)>16THENSC=16:GOSUB835
  118. 695 NEXT:CLOSE2:CLOSE15:OP$="":GOSUB780:OP$="DESTINATION:    "+DN$:GOSUB790
  119. 700 BC$="INSERT DESTINATION DISK INTO DRIVE":GOSUB965
  120. 705 GOSUB955:IFID$=RIGHT$(DN$,2)THENEN$="00":ED$="OK":GOTO715
  121. 710 EN$="*1":ED$="SOURCE ID FOUND":ET$="00":ES$="00":GOSUB800:GOTO700
  122. 715 GOSUB800:OP$="WRITING DATA FROM BUFFER":GOSUB780:GOSUB910
  123. 720 OP$="BACKUP FINISHED":GOSUB780:OP$="":GOSUB810:GOSUB785:GOSUB790
  124. 725 BC$="REMOVE DESTINATION DISK FROM DRIVE":GOSUB965:GOTO100
  125. 730 B$="":PRINTLEFT$("",DN)SPC(RT)" ";
  126. 735 PRINT"[157][168]";:FORA=1TO55:GETA$:IFA$<>""THEN745
  127. 740 NEXT:PRINT"[157] ";:FORA=1TO55:IFA$=""THENNEXT:GOTO735
  128. 745 IFASC(A$)=13THENPRINT"[157] ":RETURN
  129. 746 IFASC(A$)=133THEN100
  130. 750 IFASC(A$)<>20THEN765
  131. 755 IFLEN(B$)=0THENNEXT:GOTO735
  132. 760 B$=LEFT$(B$,LEN(B$)-1):PRINT"[157] [157][157] ";:GOTO735
  133. 765 IFA$<" "ORA$>"Z"THENNEXT:GOTO735
  134. 770 IFLEN(B$)<LNTHENB$=B$+A$:PRINT"[157]"A$"";:GOTO735
  135. 775 NEXT:GOTO735
  136. 780 PRINT""BL$OP$:RETURN
  137. 785 PRINT""BL$OP$:RETURN
  138. 790 PRINT""BL$OP$:RETURN
  139. 795 PRINT""BL$OP$:RETURN
  140. 800 CLOSE2:CLOSE15:OP$=EN$+", "+ED$+","+ET$+","+ES$
  141. 805 PRINT""BL$OP$:RETURN
  142. 810 PRINT""BL$:RETURN
  143. 815 FORA=SBTOEBSTEP258:POKEA,0:POKEA+1,0:NEXT:BP=SB:RETURN
  144. 820 IFBR=0THENPT=PT+1:IFPT>8THENPT=1:SP=SP+1:GOTO830
  145. 825 IFBR=1THENPT=PT-1:IFPT<0THENPT=7:SP=SP-1
  146. 830 POKESP,C(PT):RETURN
  147. 835 BR=0:PRINT#15,"U1:"2;0;TR;SC:PRINT#15,"B-P:"2;0
  148. 840 POKEBP,TR:POKEBP+1,SC:BP=BP+2:HI=INT(BP/256):LO=BP-(HI*256):POKE839,LO
  149. 845 POKE840,HI:GOSUB820:SYS828:GOSUB820:INPUT#15,EN$,ED$,ET$,ES$
  150. 850 IFEN$<>"00"THEN980
  151. 855 BP=BP+256:IFBP+256<EBTHENRETURN
  152. 860 CLOSE2:CLOSE15:OP$="":GOSUB780:OP$="DESTINATION:    "+DN$:GOSUB790
  153. 865 BC$="INSERT DESTINATION DISK INTO DRIVE":GOSUB965
  154. 870 GOSUB955:IFID$=RIGHT$(DN$,2)THENEN$="00":ED$="OK":GOSUB800:GOTO880
  155. 875 EN$="*1":ED$="SOURCE ID FOUND":ET$="00":ES$="00":GOSUB800:GOTO865
  156. 880 OP$="WRITING DATA FROM BUFFER":GOSUB780:GOSUB910:GOSUB815:OP$="":GOSUB780
  157. 885 OP$="SOURCE:         "+SN$:GOSUB790
  158. 890 BC$="INSERT SOURCE DISK INTO DRIVE":GOSUB965
  159. 895 GOSUB955:IFID$=RIGHT$(SN$,2)THENEN$="00":ED$="OK":GOSUB800:GOTO905
  160. 900 EN$="*2":ED$="DESTINATION ID FOUND":ET$="00":ES$="00":GOSUB800:GOTO890
  161. 905 OP$="READING DATA INTO BUFFER":GOSUB780:OPEN15,DI,15:OPEN2,DI,2,"#":RETURN
  162. 910 BP=SB:OPEN15,DI,15:OPEN2,DI,2,"#":BR=1
  163. 915 IF(PEEK(BP)=0ANDPEEK(BP+1)=0)ORBP+256>EBTHENCLOSE15:CLOSE2:RETURN
  164. 920 TR=PEEK(BP):SC=PEEK(BP+1):IFTR=18ANDSC=0THEN945
  165. 925 PRINT#15,"B-P:"2;0:BP=BP+2:HI=INT(BP/256):LO=BP-(HI*256):POKE856,LO
  166. 930 POKE857,HI:GOSUB820:SYS848:GOSUB820:INPUT#15,EN$,ED$,ET$,ES$
  167. 935 IFEN$<>"00"THEN980
  168. 940 PRINT#15,"U2";2;0;TR;SC:BP=BP+256:GOTO915
  169. 945 FORA=0TO15:POKE(BP+146+A),ASC(MID$(DN$,A+1,1)):NEXT:FORA=0TO1
  170. 950 POKE(BP+164+A),ASC(MID$(DN$,18+A,1)):NEXT:GOTO925
  171. 955 OPEN15,DI,15:OPEN2,DI,2,"#":PRINT#15,"U1";2;0;18;0:PRINT#15,"B-P:"2;162
  172. 960 GET#2,A$:GET#2,B$:CLOSE2:CLOSE15:ID$=A$+B$:RETURN
  173. 965 OP$=BC$:GOSUB795:FORA=1TO75:GETA$
  174. 970 IFA$=""THENNEXT:OP$="":GOSUB795:FORA=1TO75:GETA$:IFA$=""THENNEXT:GOTO965
  175. 975 OP$="":GOSUB795:IFA$<>"[133]"THENRETURN
  176. 976 GOTO100
  177. 980 GOSUB800:OP$="BACKUP INCOMPLETE --- REDO FROM START":GOSUB780
  178. 985 GOSUB780:BC$="UN-RECOVERABLE DISK ERROR":GOSUB965:GOTO100
  179.